﻿using System;
using RpcHelper;
using RpcModel;
using Wedonek.RpcStore.Service.DAL;
using Wedonek.RpcStore.Service.Interface;
using Wedonek.RpcStore.Service.Model;

namespace Wedonek.RpcStore.Service.Collect
{
    internal class ResourceCollect : BasicCollect<ResourceDAL>, IResourceCollect
    {
        public ResourceData Get(Guid id)
        {
            ResourceData resource = base.BasicDAL.Get(id);
            if (resource == null)
            {
                throw new ErrorException("rpc.store.resource.not.find");
            }
            return resource;
        }

        public ResourceData[] Query(ResourceQueryParam query, IBasicPage paging, out long count)
        {
            return base.BasicDAL.Query(query, paging, out count);
        }
    }
}
